{include file='public/header'}
<body>
	<div class="sectionY">
		<a href="javascript:history.back();">
			<img src="__PUBLIC__/home/images/a19.png" alt="" class="a1">
		</a>
		<p class="p1">消息中心</p>
	</div>
	<div class="kong1"></div>
	<div class="new_section1" id="wrapper">
		<div class="container" id="scroller">
			<div id="pullDown">
				<span class="pullDownLabel">下拉刷新</span>
			</div>

			<ul class="clearfix" id="ulData">
			</ul>

			<!--上拉加载模块-->

			<div id="pullUp">
				<span class="pullUpLabel">上拉加载更多</span>
			</div>
			<div id="endData" style="display: none; ">
				<span class="dataEnd">--我是有底线的--</span>
			</div>
			<!--上拉加载模块-->

		</div>
	</div>
</body>
<script>
	var mScroll;
	var isRefresh = true;
	var p = 1; //当前页码
	var onePageCount = 20; //每页显示多少个
	var end=false;
	window.onload = function() {
		mScroll = PullDownAddUP("wrapper", function(loadType) {
			if (loadType == "refresh") { //下拉刷新
				isRefresh = true;
			} else { //上拉加载
				isRefresh = false;
				if(end){
					return true;
				}
			}
			loadData();
		});
		loadData();
	}
	function loadData() {
		if (isRefresh) {
			p = 1;
			$("#pullUp").show();
			$("#endData").hide();
			end = false;
			document.getElementById("ulData").innerHTML = "";
		} else {
			p++;
		}
		//加载渲染数据
		$.post('{:url("getNoticeData")}', {page:p, pageNum:onePageCount}, function (res) {
			console.log(res);
			if(res.result_code == 0){
				let data = res.result_data.data, total=res.result_data.total;
				let _li = "";
				if(total<onePageCount){
					$("#pullUp").hide();
					$("#endData").show();
					end = true;
				}
				$.each(data, function (i,v) {
					_li += '<li class="clearfix">';
					if(v.read == 1){
						_li += '	<span class="s_dian2"></span>';
					}else{
						_li += '	<span class="s_dian1"></span>';
					}
					_li += '	<a href="{:url(\'Notice/detail\')}?notice_id='+v.id+'">' +
					'	<div class="left">' +
					'		<p class="p1 chao">'+v.title+'</p>' +
					'		<p class="p2 chao">'+v.description+'</p>' +
					'	</div>' +
					'	<div class="right">' +
					'		<p class="p1">'+v.times+'</p>' +
					'	</div>' +
					'	</a>' +
					'</li>';
				});
				$("#ulData").append(_li);
				mScroll.refresh();
			}else{
				// mScroll.destroy();
				end = true;
				modal.msg(res.result_info);
			}
		});
	}
</script>
</html>